;; 线段的描述

(define (make-segment s e)
  (cons s e))

(define (start-segment segment)
  (car segment))

(define (end-segment segment)
  (cdr segment))

;; 线段中点
(define (midpoint-segment segment)
  (make-point
   (/
    (+ (x-point (start-segment segment))
       (x-point (end-segment segment)))
    2)
   (/
    (+ (y-point (start-segment segment))
       (y-point (end-segment segment)))
    2)
   ))


(define (make-point x y)
  (cons x y))

(define (x-point p) (car p))
(define (y-point p) (cdr p))

(define (print-point p)
  (display "(")
  (display (x-point p))
  (display ",")
  (display (y-point p))
  (display ")")
  (newline))

(define segment-2-2 (make-segment (make-point 0 0) (make-point 2 2)))
